package singleton;

public class SingletonTest02 {

    private static SingletonTest02 instance;

    private SingletonTest02(){};

    //不加synchronized则为线程不安全
    public static synchronized SingletonTest02 getInstance() {

        if (null == instance){
            instance = new SingletonTest02();
        }
        return instance;
    }

}
